package com.lanhe.app.controller.order;

import com.lanhe.common.constant.Constants;
import com.lanhe.common.core.controller.BaseController;
import com.lanhe.common.core.page.TableDataInfo;
import com.lanhe.order.domain.LhOrdersPool;
import com.lanhe.order.service.ILhOrdersPoolService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;


/**
 * 汇总订单
 *
 * @author zhanggl
 * @date 2023年12月27日22:43:46
 */
@RestController
@RequestMapping("/api/pool/orders")
@Slf4j
public class ApiLhOrdersPoolController extends BaseController {

	@Resource
	private ILhOrdersPoolService ordersPoolService;


	/**
	 * 分页查询所有数据
	 */
	@GetMapping("/list")
	public TableDataInfo list(LhOrdersPool orders) {
		startPage();
		orders.setMemberId(getUserId());
		List<LhOrdersPool> list = ordersPoolService.selectOrdersList(orders);
		for (LhOrdersPool lhOrdersPool : list) {
			lhOrdersPool.setOriginName(Constants.OrdersOriginType.getOrdersOriginTypeName(lhOrdersPool.getOrigin()));
			lhOrdersPool.setStatusName(Constants.PoolOrderStatus.getPoolStatusName(lhOrdersPool.getStatus()));
		}
		return getDataTable(list);
	}
}

